package com.ftg.learn.chapter10.base02.service;

import com.ftg.learn.chapter10.base02.mapper.StudentMapper;
import com.ftg.learn.chapter10.base02.util.BaseUtil;
import com.ftg.learn.chapter10.base02.util.PageInfo;
import com.ftg.learn.chapter10.base02.vo.StudentListVo;
import com.github.pagehelper.PageHelper;

import java.util.List;

/**
 * 学生业务
 *
 * @author 布衣
 */
public class StudentService {

    private StudentMapper studentMapper = BaseUtil.getBean(StudentMapper.class);

    public com.github.pagehelper.PageInfo<StudentListVo> list(String stuName,String className,Integer start,Integer pageSize){
        PageHelper.startPage(start, pageSize);
        List<StudentListVo> list = studentMapper.list(stuName, className);
        com.github.pagehelper.PageInfo<StudentListVo> pageInfo = new com.github.pagehelper.PageInfo<>(list);
        return pageInfo;
//        List<StudentListVo> list = studentMapper.list(stuName,className,start,pageSize);
//        Integer total = studentMapper.count(stuName,className);
//        PageInfo<StudentListVo> page = PageInfo.successForList("分页功能", list, total);
//        BaseUtil.GetInstance().close();
//        return page;
    }

}
